Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(node): do not reset farthest_acceptance_distance
Browse files Browse the repository at this point in the history
maqi committed Apr 17, 2024
1 parent 6da215f commit 43bb897
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 6 additions & 3 deletions sn_networking/src/cmd.rs
Original file line number Diff line number Diff line change
@@ -476,9 +476,12 @@ impl SwarmDriver {

match result {
Ok(_) => {
// We've stored the record fine, which means our replication
// fetcher should not be limited
self.replication_fetcher.clear_farthest_on_full();
// `replication_fetcher.farthest_acceptable_distance` shall only get
// shrinked, instead of expanding, even with more nodes joined to share
// the responsibility. Hence no need to reset it.
// Also, as `record_store` is `prune 1 on 1 success put`, which means
// once capacity reached max_records, there is only chance of rising slowly.
// Due to the async/parrellel handling in replication_fetcher & record_store.
}
Err(StoreError::MaxRecords) => {
// In case the capacity reaches full, restrict replication_fetcher to
7 changes: 0 additions & 7 deletions sn_networking/src/replication_fetcher.rs
Original file line number Diff line number Diff line change
@@ -153,13 +153,6 @@ impl ReplicationFetcher {
keys_to_fetch
}

// Node is storing and or pruning data fine, any fetch (ongoing or new) shall no longer be restricted
// by the fetcher itself (data is checked for being "close" at a higher level before keys are fed in
// to the ReplicationFetcher)
pub(crate) fn clear_farthest_on_full(&mut self) {
self.farthest_acceptable_distance = None;
}

// Node is full, any fetch (ongoing or new) shall no farther than the current farthest.
pub(crate) fn set_farthest_on_full(&mut self, farthest_in: Option<RecordKey>) {
let self_addr = NetworkAddress::from_peer(self.self_peer_id);

0 comments on commit 43bb897

Please sign in to comment.