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:
parent
910f4cbf40
commit
d476c18339
|
@ -53,7 +53,7 @@ const FANOUT: usize = 3;
|
||||||
///
|
///
|
||||||
/// We also hedge requests, so we may retry up to twice this many times. Hedged
|
/// We also hedge requests, so we may retry up to twice this many times. Hedged
|
||||||
/// retries may be concurrent, inner retries are sequential.
|
/// 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.
|
/// A lower bound on the user-specified lookahead limit.
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Check the relationship between various sync timeouts and delays.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
convert::TryInto,
|
convert::TryInto,
|
||||||
sync::{
|
sync::{
|
||||||
|
@ -34,15 +36,10 @@ fn ensure_timeouts_consistent() {
|
||||||
"Sync restart should allow for pending and buffered requests to complete"
|
"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
|
// We multiply by 2, because the Hedge can wait up to BLOCK_DOWNLOAD_TIMEOUT
|
||||||
// seconds before retrying.
|
// seconds before retrying.
|
||||||
const BLOCK_DOWNLOAD_HEDGE_TIMEOUT: u64 =
|
const BLOCK_DOWNLOAD_HEDGE_TIMEOUT: u64 =
|
||||||
2 * BLOCK_DOWNLOAD_RETRY_LIMIT as u64 * BLOCK_DOWNLOAD_TIMEOUT.as_secs();
|
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
|
// This constraint avoids spurious failures due to block download timeouts
|
||||||
assert!(
|
assert!(
|
||||||
|
|
Loading…
Reference in New Issue