fix(sync): Add an extra block retry, to speed up the initial sync (#4185)

* Increase the block download retry limit to 3

* Remove an obsolete timing check from the tests

We cancel all block downloads for each sync restart,
so we don't need to wait for the maximum hedged download time.
This commit is contained in:
teor 2022-04-27 02:28:09 +10:00 committed by GitHub
parent 910f4cbf40
commit d476c18339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -53,7 +53,7 @@ const FANOUT: usize = 3;
///
/// We also hedge requests, so we may retry up to twice this many times. Hedged
/// retries may be concurrent, inner retries are sequential.
const BLOCK_DOWNLOAD_RETRY_LIMIT: usize = 2;
const BLOCK_DOWNLOAD_RETRY_LIMIT: usize = 3;
/// A lower bound on the user-specified lookahead limit.
///

View File

@ -1,3 +1,5 @@
//! Check the relationship between various sync timeouts and delays.
use std::{
convert::TryInto,
sync::{
@ -34,15 +36,10 @@ fn ensure_timeouts_consistent() {
"Sync restart should allow for pending and buffered requests to complete"
);
// This constraint avoids spurious failures due to block retries timing out.
// We multiply by 2, because the Hedge can wait up to BLOCK_DOWNLOAD_TIMEOUT
// seconds before retrying.
const BLOCK_DOWNLOAD_HEDGE_TIMEOUT: u64 =
2 * BLOCK_DOWNLOAD_RETRY_LIMIT as u64 * BLOCK_DOWNLOAD_TIMEOUT.as_secs();
assert!(
SYNC_RESTART_DELAY.as_secs() > BLOCK_DOWNLOAD_HEDGE_TIMEOUT,
"Sync restart should allow for block downloads to time out on every retry"
);
// This constraint avoids spurious failures due to block download timeouts
assert!(