Skip to content

Commit

Permalink
Remove Misleading Fast-Sync Logging (#2158)
Browse files Browse the repository at this point in the history
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
  • Loading branch information
RatanRSur and macfarla authored Apr 26, 2021
1 parent 46d4952 commit efe845b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ private CompletableFuture<FastSyncState> handleFailure(final Throwable error) {
if (ExceptionUtils.rootCause(error) instanceof FastSyncException) {
return CompletableFuture.failedFuture(error);
} else if (ExceptionUtils.rootCause(error) instanceof StalledDownloadException) {
LOG.warn(
"Fast sync was unable to download the world state. Retrying with a new pivot block.");
LOG.info("Re-pivoting to newer block.");
return start(FastSyncState.EMPTY_SYNC_STATE);
} else {
LOG.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.hyperledger.besu.plugin.services.metrics.Counter;
import org.hyperledger.besu.services.tasks.Task;

import java.text.DecimalFormat;
import java.util.function.LongSupplier;

import org.apache.logging.log4j.LogManager;
Expand All @@ -35,7 +34,6 @@ public class CompleteTaskStep {
private final RunnableCounter completedRequestsCounter;
private final Counter retriedRequestsCounter;
private final LongSupplier worldStatePendingRequestsCurrentSupplier;
private final DecimalFormat doubleFormatter = new DecimalFormat("#.##");

public CompleteTaskStep(
final WorldStateStorage worldStateStorage,
Expand Down Expand Up @@ -78,16 +76,9 @@ public void markAsCompleteOrFailed(

private void displayWorldStateSyncProgress() {
LOG.info(
"Downloaded {} world state nodes. At least {} nodes remaining. Estimated World State completion: {} %.",
"Downloaded {} world state nodes. At least {} nodes remaining.",
getCompletedRequests(),
worldStatePendingRequestsCurrentSupplier.getAsLong(),
doubleFormatter.format(computeWorldStateSyncProgress() * 100.0));
}

public double computeWorldStateSyncProgress() {
final double pendingRequests = getPendingRequests();
final double completedRequests = getCompletedRequests();
return completedRequests / (completedRequests + pendingRequests);
worldStatePendingRequestsCurrentSupplier.getAsLong());
}

long getCompletedRequests() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ public void shouldEnqueueChildrenAndMarkCompleteWhenTaskHasData() {
verify(downloadState).checkCompletion(worldStateStorage, blockHeader);
}

@Test
public void shouldComputeWorldStateProgress() {
completeTaskStep.markAsCompleteOrFailed(blockHeader, downloadState, validTask());
// One task has been completed and there are 2 pending requests, progress should be 1/4 (25%)
assertThat(completeTaskStep.computeWorldStateSyncProgress()).isEqualTo(1.0 / 4.0);
}

private StubTask validTask() {
final Hash hash =
Hash.fromHexString("0x601a7b0d0267209790cf4c4d9e0cab11b26c537e2ade006412f48b070010e847");
Expand Down

0 comments on commit efe845b

Please sign in to comment.